<?php
require_once('includes/bootstrap.php');
	
	if (empty($_SESSION[SESSION_NAME]))
	{
		header("HTTP/1.0 404 Not Found");
		exit;
	}

?>

<html>
	<head>
		<?php include_once('includes/head.php'); ?>
	</head>

	<body>

		<?php include_once('includes/menu_admin.php'); ?>

		<h1>Articles</h1>

		<table class="display dataTable">
			<thead>
				<tr>
					<th>Nom</th>
					<th>Prix</th>
					<th>Description</th>
					<th>Code</th>
				</tr>
			</thead>

			<tbody>
				<?php
				$req = mysql_query('SELECT * FROM items ORDER BY name ASC');

				$i = 0;

				while ($row = mysql_fetch_assoc($req))
				{
					if ($i % 2 == 0)
						echo '<tr class="gradeA even">';
					else
						echo '<tr class="gradeA odd">';

					echo '	<td>' . $row['name'] . '</td>';
					echo '	<td>' . $row['price'] . '</td>';
					echo '	<td>' . nl2br($row['description']) . '</td>';
					echo '	<td>' . $row['code'] . '</td>';
					echo '</tr>';

					$i++;
				}

				?>
			</tbody>

		</table>

		<script type="text/javascript">
			$('table').dataTable({
				"iDisplayLength": 20,
				"bJQueryUI": true
			});

		</script>

	</body>

</html>
